<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> 
<%@page import="com.lmpop.trade.ti_shipping_area.Ti_shipping_areaInfo" %>
<%@page import="java.text.DecimalFormat" %>
<%
	 
	 
   String province="",all_goods_num="0",total_price="0",all_goods_weight="0",shipping_id=""; 	 
	 
   if(request.getParameter("province")!=null)
   {
      province = request.getParameter("province");
   }
    if(request.getParameter("all_goods_num")!=null)
   {
      all_goods_num = request.getParameter("all_goods_num");
   }
    if(request.getParameter("total_price")!=null)
   {
      total_price = request.getParameter("total_price");
   }
   if(request.getParameter("all_goods_weight")!=null)
   {
      all_goods_weight = request.getParameter("all_goods_weight");
   }
   if(request.getParameter("shipping_id")!=null)
   {
      shipping_id = request.getParameter("shipping_id");
   }
   
   Ti_shipping_areaInfo ti_shipping_areaInfo =new Ti_shipping_areaInfo();     
   DecimalFormat  df  = new DecimalFormat("0.00");
   Hashtable tMap = new Hashtable();
   tMap.put("shipping_id",shipping_id);
   tMap.put("area_id",province);
  
   
   Hashtable shipMap = ti_shipping_areaInfo.getOneAreaShipping(tMap);
  
   String cal_type="",one_fare="0",first_fare="0",con_fare="0",free_fare="0",arrive_fare="0",first_weigth="0";
   if(shipMap.get("cal_type")!=null) cal_type = shipMap.get("cal_type").toString();
   if(shipMap.get("one_fare")!=null) one_fare = shipMap.get("one_fare").toString();
   if(shipMap.get("first_fare")!=null) first_fare = shipMap.get("first_fare").toString();
   if(shipMap.get("con_fare")!=null) con_fare = shipMap.get("con_fare").toString();
   if(shipMap.get("free_fare")!=null) free_fare = shipMap.get("free_fare").toString();
   if(shipMap.get("arrive_fare")!=null) arrive_fare = shipMap.get("arrive_fare").toString();
 
   double shippfee = 0;
   if(Double.parseDouble(total_price)>=Double.parseDouble(free_fare))//大于免费额度
   {
       shippfee =0;
   }
   else
   {
       if(cal_type.equals("0"))//按重量计算
	   {
	       if(Double.parseDouble(all_goods_weight)<=1)//小于首重
		   {
		       shippfee = Double.parseDouble(first_fare);    
		   }
		   else
		   {
		      shippfee = Double.parseDouble(first_fare) + (Double.parseDouble(all_goods_weight)-1)*Double.parseDouble(con_fare);
		   }
	   
	   }
	   if(cal_type.equals("1"))//按商品件数计算
	   {
		   shippfee = Double.parseDouble(one_fare)*Integer.parseInt(all_goods_num);
	   }
   } 
  out.println(df.format(shippfee));    
%>	
 
